<template>
  <div class="about">
    <van-button type="default" @click="getPhoneVleusWeb">获取通讯录</van-button>
    <div>{{data}}</div>
    <!-- <van-button type="default" @click="getLocation1">获取</van-button> -->
    <div @click="url('user')">回到用户中心</div>
    <br/>
    <br/>
    <br/>
    <br/>
    <br/>
    <div @click="url('home')">回到首页贷前</div>
  </div>
</template>

<script>
import { Button } from 'vant';
// 1. 获取handler
var handler = {
  callHander: function (json) {
    let userAgentObj = navigator.userAgent;
    if (userAgentObj.match(/iPhone/i)) {
        return window.webkit.messageHandlers.AppCallBack.postMessage(JSON.stringify(json))
    }
  }
}
export default {
  components:{
    [Button.name]:Button
  },
  data(){
    return{
      data:''
    }
  },
  mounted(){
      let userAgentObj = navigator.userAgent;
      if (userAgentObj.match(/Android/i)) {
        // window.control.setGoneTitle();
        window.control.setvisibilityTitle();
      } else if (userAgentObj.match(/iPhone/i)) {

      }
      // window.control.setGoneTitle();setvisibilityTitle
  },
  methods:{
    getPhoneVleusWeb(){
      console.log(handler)
      let data = this.setAppAppearance();
      // let data = this.$commin.getPhoneWeb();
      this.data = data;

    },
    setAppAppearance(){
      handler.callHander({
          'name':'XXX',
          'mobile':"153XXXXX"
      });
    },
    url(data){
      if(data =='user'){
        window.location.href = 'http://h5.daxiongdaikuan.com/#/about'

      }else{
         window.location.href = 'http://h5.daxiongdaikuan.com/#/HomeBefore'
      }
    },
    refresh(){
      // window.location.href="http://192.168.0.107:8081/loanApplication#/click";

    },
    getLocation1(){
      window.getLocation=(latitude,longitude)=>{
        // alert(latitude)
              document.body.innerHTML=JSON.stringify(latitude);
        document.body.style.fontSize="14px";
      }
    }
  }
}
</script>


<style scoped >
.about{
  width:100%;
  height:100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>